package cn.ingenic.glasssync.db;

import android.database.sqlite.SQLiteDatabase;

public class DBContactsData extends DBContactsDataBase {

        private static final String TAG = "DBContactsData";
        private static final boolean DEBUG = false;

        public DBContactsData(SQLiteDatabase db) {
                super(db);
        }

        public long getCountByPhone (long contactId, String phone) {
                return getCount(ContactsDBHelper.COL_DATA_CONTACTID + " = ? AND "
                                + ContactsDBHelper.COL_DATA_TYPE + " = ? AND "
                                + ContactsDBHelper.COL_DATA_DATA + " = ? "
                            , new String [] { String.valueOf(contactId), ContactsDBHelper.DATA_TYPE_PHONE, phone });
        }

        private int _deleteByContactId (String tableName, long contactId) {
                return _deleteByConditions(tableName
                                , ContactsDBHelper.COL_DATA_CONTACTID + " = ? "
                                , new String [] { String.valueOf(contactId) });
        }

        public int deleteByContactId (long contactId) {
                return _deleteByContactId(ContactsDBHelper.TABLE_DATA, contactId);
        }

}
